/*
 * table_device.h
 *
 *  Created on: 12.06.2013
 *      Author: SpirTanol
 */

#ifndef TABLE_DEVICE_H_
#define TABLE_DEVICE_H_

// QT
#include <QTableView>
#include <QVector>

class DeviceInfo;
class DeviceModel;

class TableDevice : public QTableView
{
	Q_OBJECT

	DeviceInfo *oCurrentDevice;
	DeviceModel *oModel;

public:
	TableDevice(QVector<DeviceInfo*> *deviceList, QWidget *parent = 0);
	~TableDevice();

	inline DeviceInfo *currentDevice() const { return oCurrentDevice; }

	void addDevice();
	void clear();

protected:
	void currentChanged(const QModelIndex &current, const QModelIndex &previous); // [virtual]
	void mouseDoubleClickEvent(QMouseEvent *event); // [virtual]

signals:
	void selectedDevice(DeviceInfo *dev);
	void connectTo(DeviceInfo *dev);

};

#endif /* TABLE_DEVICE_H_ */
